<!DOCTYPE html>

<html>
    <head>
        
        <title>
            {% block title %}{% endblock %} - CodeShare
        </title>
        
        <link href="{{settings.MEDIA_URL}}css/global.css" rel="stylesheet" type="text/css" />
        {% if settings.DEBUG %}
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/mootools-13-debug.js"></script>
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/mootools-13-more-debug.js"></script>
        {% else %}
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/mootools-13.js"></script>
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/mootools-13-more.js"></script>
        {% endif %}
        
        <!--[if lt IE 9]>
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/ie/global.js"></script>
        <![endif]-->
        <script type="text/javascript" src="{{settings.MEDIA_URL}}js/global.js"></script>
        
        {% if user.is_authenticated %}
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/user/global.js"></script>
            <link href="{{settings.MEDIA_URL}}css/user/global.css" rel="stylesheet" type="text/css" />
        {% else %}
            <script type="text/javascript" src="{{settings.MEDIA_URL}}js/guest/global.js"></script>
            <link href="{{settings.MEDIA_URL}}css/guest/global.css" rel="stylesheet" type="text/css" />
        {% endif %}

        {% block header %}{% endblock %}
    </head>
    <body class="body">
        <header>
            <nav id="main">
                <span id="logo">
                    <a href="{% url main:index %}">
                        <span class="logo-part1">Code</span><span class="logo-part2">Share</span>
                    </a>
                </span> 
                <a href="{% url main:index %}" title="Index">
                    Index</a>
                |
                <a href="{% url main:submit %}" title="Submit Your Code" id="submit-dropdown">
                    Submit code ▼</a>
                |
                <a href="{% url main:create_project %}" title="Create a New Project" id="project-dropdown"
                    {% if user.is_anonymous %}class="dropdown-disabled"{% endif %}>
                    Your code {% if user.is_authenticated %}▼{% endif %}</a>
                
                <ul class="dropdown" id="for-submit-dropdown">
                    {% if user.is_anonymous %}
                        <li>
                            <a href="{% url account:login %}">
                                Login to submit code
                            </a>
                        </li>
                    {% else %}
                        <li class="dropdown-no-link">
                            Create in project:
                        </li>
                        <li class="hr">
                            <hr class="dropdown-break" />
                        </li>
                        <li>
                            <a href="{% url main:create_project %}?code=true">
                                New Project...
                            </a>
                        </li>
                        {% for project in user.project_set.all %}
                            <li>
                                <a href="{% url main:submit %}?project={{project.pk}}">
                                    {{project}}
                                </a>
                            </li>
                        {% endfor %}
                    {% endif %}
                </ul>
                <ul class="dropdown" id="for-project-dropdown">
                    {% for code in user.code_set.all %}
                        <li>
                            <a href="{% url main:view code.pk %}">{{code.title|truncatewords:"3"}}</a>
                        </li>
                    {% empty %}
                        <li class="dropdown-no-link">
                            You haven't submitted any...
                        </li>
                    {% endfor %}
                </ul>
            </nav>
            
            <div id="user-links">
                {% if user.is_authenticated %}
                    Welcome, <span class="bold">{{user.username}}</span>
                    |
                    <a href="{% url account:view_profile user.pk %}">
                        Your profile</a>
                    |
                    <a href="{% url account:logout %}">
                        Log Out
                    </a>
                {% else %}
                    You are <span class="bold">not logged in.</span>
                    |
                    <a href="{% url account:login %}?next={{request.path}}">
                        Login
                    </a>
                    |
                    <a href="{% url account:register %}">
                        Register
                    </a>
                {% endif %}
            </div>
            <hr id="separator" />
        </header>
        {% include "messages.html" %}
        
        <div id="content" style="width:100%;height:100%">
            {% block content %}{% endblock %}
        </div>
        <footer>
            <hr />
            Note that this is a <span class="italics">test project</span>.  
            It should <span class="italics">not</span> be run in a production setting as is.
            <br />
            <div class="footer-logos">
                <a href="http://www.djangoproject.org/" target="_blank">
                    <img src="{{settings.MEDIA_URL}}imgs/logos/django.gif" />
                </a>
                <a href="http://www.python.org/" target="_blank">
                    <img src="{{settings.MEDIA_URL}}imgs/logos/python.png" />
                </a>
                <img src="{{settings.MEDIA_URL}}imgs/logos/html.png" />
                <img style="border:0;width:88px;height:31px"
                    src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
                    alt="Valid CSS!" />
            </div>
        </footer>
    </body>
</html>
